home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / init.d / apparmor < prev    next >
Text File  |  2008-10-08  |  3KB  |  121 lines

  1. #!/bin/sh
  2. #
  3. #    $Id: rc.apparmor.debian 703 2007-05-28 04:42:26Z steve-beattie $
  4. #
  5. # ----------------------------------------------------------------------
  6. #    Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
  7. #    NOVELL (All rights reserved)
  8. #
  9. #    This program is free software; you can redistribute it and/or
  10. #    modify it under the terms of version 2 of the GNU General Public
  11. #    License published by the Free Software Foundation.
  12. #
  13. #    This program is distributed in the hope that it will be useful,
  14. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. #    GNU General Public License for more details.
  17. #
  18. #    You should have received a copy of the GNU General Public License
  19. #    along with this program; if not, contact Novell, Inc.
  20. # ----------------------------------------------------------------------
  21. # rc.apparmor by Steve Beattie
  22. #
  23. # /etc/init.d/apparmor
  24. #
  25. # chkconfig: 2345 01 99
  26. # description: AppArmor rc file. This rc script inserts the apparmor \
  27. #            module and runs the parser on the /etc/apparmor.d/ \
  28. #           directory.
  29. #
  30. ### BEGIN INIT INFO
  31. # Provides: apparmor
  32. # Required-Start:
  33. # Required-Stop:
  34. # Default-Start: 3 4 5
  35. # Default-Stop: 0 1 2 6
  36. # Short-Description: AppArmor initialization
  37. # Description: AppArmor rc file. This rc script inserts the apparmor
  38. #    module and runs the parser on the /etc/apparmor.d/
  39. #    directory.
  40. ### END INIT INFO
  41. APPARMOR_FUNCTIONS=/etc/apparmor/rc.apparmor.functions
  42.  
  43. aa_action() {
  44.     STRING=$1
  45.     shift
  46.     $*
  47.     rc=$?
  48.     if [ $rc -eq 0 ] ; then
  49.         aa_log_success_msg $"$STRING "
  50.     else
  51.         aa_log_failure_msg $"$STRING "
  52.     fi
  53.     return $rc
  54. }
  55.  
  56. aa_log_success_msg() {
  57.      [ -n "$1" ] && echo -n $1
  58.         echo ": done."
  59. }
  60.  
  61. aa_log_warning_msg() {
  62.      [ -n "$1" ] && echo -n $1
  63.         echo ": Warning."
  64. }
  65.  
  66. aa_log_failure_msg() {
  67.      [ -n "$1" ] && echo -n $1
  68.         echo ": Failed."
  69. }
  70.  
  71. aa_log_skipped_msg() {
  72.      [ -n "$1" ] && echo -n $1
  73.         echo ": Skipped."
  74. }
  75.  
  76. usage() {
  77.     echo "Usage: $0 {start|stop|restart|try-restart|reload|force-reload|status|kill}"
  78. }
  79.  
  80. # source apparmor function library
  81. if [ -f "${APPARMOR_FUNCTIONS}" ]; then
  82.     . ${APPARMOR_FUNCTIONS}
  83. else
  84.     aa_log_failure_msg "Unable to find AppArmor initscript functions"
  85.     exit 1
  86. fi
  87.  
  88. test -x ${PARSER} || exit 0 # by debian policy
  89.  
  90. case "$1" in
  91.     start)
  92.         apparmor_start
  93.         rc=$?
  94.         ;;
  95.     stop)
  96.         apparmor_stop
  97.         rc=$?
  98.         ;;
  99.     restart|reload|force-reload)
  100.         apparmor_restart
  101.         rc=$?
  102.         ;;
  103.     try-restart)
  104.         apparmor_try_restart
  105.         rc=$?
  106.         ;;
  107.     kill)
  108.         apparmor_kill
  109.         rc=$?
  110.         ;;
  111.     status)
  112.         apparmor_status
  113.         rc=$?
  114.         ;;
  115.     *)
  116.         usage
  117.         exit 1
  118.         ;;
  119.     esac
  120. exit $rc
  121.